package abel.wlmr.model.type;

import java.util.HashMap;
import java.util.Map;

public enum SensorStatusType {

    Ready(0),
    ExceedUp(1),
    ExceedDown(2),
    Broken(3);

    private byte value;

    private static Map<Byte, SensorStatusType> statMap = new HashMap<>();

    static {
        for (SensorStatusType s : SensorStatusType.values()) {
            statMap.put(s.value, s);
        }
    }

    private SensorStatusType(int v) {
        this.value = (byte) v;
    }

    /**
     * @return the value
     */
    public byte getValue() {
        return value;
    }

    public static SensorStatusType findEnumByValue(byte v) {
        if (statMap.containsKey(v)) {
            return statMap.get(v);
        }

        return null;
    }
}
